﻿@model WebApplication1.ViewModels.MovieFormViewModel
@{
    ViewBag.Title = "MovieForm";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>MovieForm</h2>

@using (Html.BeginForm("Save", "Movies"))
{
    <div class="form-group">
        @Html.LabelFor(m => m.Name)
        @Html.TextBoxFor(m => m.Name, new { @class = "form-control" })
        @Html.ValidationMessageFor(m => m.Name)
    </div>
    <div class="form-group">
        @Html.LabelFor(m => m.Genre.Name)
        @Html.DropDownListFor(m => m.GenreId, 
        new SelectList(Model.Genres, "Id", "Name"), "Select genre", new { @class = "form-control" })
        @Html.ValidationMessageFor(m => m.GenreId)
    </div>
    <div class="form-group">
        @Html.LabelFor(m => m.startedDate)
        @Html.EditorFor(m => m.startedDate, new { htmlAttributes = new { @class = "form-control" } })                
        @Html.ValidationMessageFor(m => m.startedDate)
    </div>
    <div class="form-group">
        @Html.LabelFor(m => m.entryDate)        
        @Html.EditorFor(m => m.entryDate, new { htmlAttributes = new { @class = "form-control"} })
        @Html.ValidationMessageFor(m => m.entryDate)           
    </div>
    <div class="form-group">
        <label>products remaining</label>
        @Html.TextBoxFor(m => m.count, new { htmlAttributes = new { @class = "form-control" } }) 
        @Html.ValidationMessageFor(m => m.count)
    </div>

    @Html.HiddenFor(m => m.Id)
    <button type="submit" class="btn btn-primary">Save</button>
}